using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Media3D;
using _3DHouse.CustomControl;

namespace _3DHouse.Lib
{
    /// <summary>
    /// 添加的撤消重做控制类
    /// </summary>
    class InsertCommand : ICommand
    {
        private Cube _UiElement;
        private Viewport3D _Container;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="uiElement">删除的对象</param>
        /// <param name="container">容器</param>
        public InsertCommand(Cube uiElement, Viewport3D container)
        {
            _UiElement = uiElement;
            _Container = container;
        }

        #region ICommand Members

        public void Execute()
        {
            if (!_Container.Children.Contains(_UiElement))
            {
                _Container.Children.Add(_UiElement);
            }
        }

        public void UnExecute()
        {
            _Container.Children.Remove(_UiElement);
        }

        #endregion
    } 
}
